package com.pipi.mq.rocketmq.base.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @Package com.pipi.mq.rocketmq.base.config
 * @author: 皮皮（pipi@maihaoche.com）
 * @date: 2020/4/18 5:57 PM
 */
@Configuration
@PropertySource("classpath:application.properties")
public class PropertiesConfig {


    public static String nameServerAddress;

    public static String producerGroup;

    public static String topicSync;
    public static String tagSync;
    public static String consumerGroupSync;

    public static String topicAsync;
    public static String tagAsync;
    public static String consumerGroupAsync;

    public static String topicOneWay;
    public static String tagOneWay;
    public static String consumerGroupOneWay;

    @Value("${rocketmq.config.nameServerAddress}")
    private void setNameServerAddress(String nameServerAddress) {
        PropertiesConfig.nameServerAddress = nameServerAddress;
    }

    @Value("${rocketmq.config.producer.group}")
    private void setProducerGroup(String producerGroup) {
        PropertiesConfig.producerGroup = producerGroup;
    }


    @Value("${rocketmq.config.topic.sync}")
    private void setTopicSync(String topicSync) {
        PropertiesConfig.topicSync = topicSync;
    }

    @Value("${rocketmq.config.tag.sync}")
    private void setTagSync(String tagSync) {
        PropertiesConfig.tagSync = tagSync;
    }

    @Value("${rocketmq.config.consumer.group.sync}")
    private void setConsumerGroupSync(String consumerGroupSync) {
        PropertiesConfig.consumerGroupSync= consumerGroupSync;
    }

    @Value("${rocketmq.config.topic.async}")
    private void setTopicAsync(String topicAsync) {
        PropertiesConfig.topicAsync = topicAsync;
    }

    @Value("${rocketmq.config.tag.async}")
    private void setTagAsync(String tagAsync) {
        PropertiesConfig.tagAsync = tagAsync;
    }

    @Value("${rocketmq.config.consumer.group.async}")
    private void setConsumerGroupAsync(String consumerGroupAsync) {
        PropertiesConfig.consumerGroupAsync = consumerGroupAsync;
    }

    @Value("${rocketmq.config.topic.one.way}")
    private void setTopicOneWay(String topicOneWay) {
        PropertiesConfig.topicOneWay = topicOneWay;
    }

    @Value("${rocketmq.config.tag.one.way}")
    private void setTagOneWay(String tagOneWay) {
        PropertiesConfig.tagOneWay = tagOneWay;
    }

    @Value("${rocketmq.config.consumer.group.one.way}")
    private void setConsumerGroupOneWay(String consumerGroupOneWay) {
        PropertiesConfig.consumerGroupOneWay = consumerGroupOneWay;
    }
}
